//
//  ZQEmotion.m
//  柳州微博
//
//  Created by Apple_Lzzy45 on 16/11/11.
//  Copyright © 2016年 Apple_Lzzy40. All rights reserved.
//

#import "ZQkeyboardEmotion.h"
#import "Masonry.h"
#import "ZQEmotionTarbar.h"
#import "ZQEmotionListView.h"

@interface ZQkeyboardEmotion ()<ZQEmotionTarbarDegleate>

@property(nonatomic ,strong) ZQEmotionListView *expression;
@property(nonatomic ,strong) ZQEmotionTarbar *expressionTool;

@end

@implementation ZQkeyboardEmotion
/**
 *  懒加载
 */
-(ZQEmotionListView *)expression
{
    if (!_expression) {
        _expression = [[ZQEmotionListView alloc]init];
       
    }
    return _expression;
}
-(ZQEmotionTarbar *)expressionTool
{
    if (!_expressionTool) {
        _expressionTool = [[ZQEmotionTarbar alloc]init];
        _expressionTool.degleate = self;
    }
    return _expressionTool;
}
/**
 *  初始化
 */
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self == [super initWithFrame:frame]) {
        [self addSubview: self.expression];
        
        
        [self addSubview: self.expressionTool];
    }
    return self;
}
/**
 *  布局
 */
-(void)layoutSubviews
{
    [super layoutSubviews];
    [_expression mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.mas_top);
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom).offset(-36);
        
    }];
    [_expressionTool mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_expression.mas_bottom);
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        
    }];
}

/**
 *  表情按钮代理事件
 */
-(void)emotionTarBar:(ZQEmotionTarbar *)tarbar didSelectBtn:(ZQEmotionTarbarButtonType)buttonType
{
        switch (buttonType) {
        case ZQEmotionTarbarButtonTypeRecent:
            NSLog(@"最近");
            break;
            
        case ZQEmotionTarbarButtonTypeDefault:
            {
                NSLog(@"默认");
                NSString *filePath =[[NSBundle mainBundle]pathForResource:@"EmotionIcons/default/info.plist" ofType:nil];
                NSArray *defaultArray =[NSArray arrayWithContentsOfFile:filePath];
                NSLog(@"默认表情列表=%@",defaultArray);
            
            }
            break;
        case ZQEmotionTarbarButtonTypeEmoji:
            
            {
               NSLog(@"Emoji");
                NSString *filePath =[[NSBundle mainBundle]pathForResource:@"EmotionIcons/default/info.plist" ofType:nil];
                NSArray *defaultArray =[NSArray arrayWithContentsOfFile:filePath];
                NSLog(@"Emoji表情列表=%@",defaultArray);
                
            }

            break;
        case ZQEmotionTarbarButtonTypeLxh:
            NSLog(@"浪小花");
            //打开相机
            break;
        default:
            break;
    }




}
@end

